// 7.修饰符类型
/**
 * 1. 修饰符类型 short、long、signed、unsigned
 * s、l、si、un 可以修饰整型(int)
 * si、un修饰 可以修饰字符型(char)
 * long 修饰 可以修饰双精度(double)
 * 
 * 速记符号声明，只写unsigned、short、long，int是隐含的
 * 
 * 2. 有符号数与无符号数转化问题
 * 如 无符号短型 转 有符号短型 (short signed)((short unsigned)50000) == -15536
 * 
 * 3. 类型限定符
 * const、volatile、restrict
*/

#include <iostream>
int main(void)
{
  // unsigned wchar_t c = L'X'; // 类型组合符无效
  signed char c = 'X';

  unsigned a = 1;

  std::cout << "wchar_t c:" << c << std::endl;

  // 速记符号
  short i;          // 有符号短整数
  short unsigned j; // 无符号短整数
  j = 50000;

  i = j;

  std::cout << "无符号赋值给有符号"
            << "\n"
            << "有符号i:" << i << "\n"                                             // -15536
            << "无符号j:" << j << "\n"                                             // 50000
            << "强制转换j:" << (short signed)j << "\n"                             // -15536
            << "强制转换j:" << (short signed)((short unsigned)50000) << std::endl; // -15536

  printf("----------end----------\n");
}